package util
{
	import enums.ColorLib;
	import enums.main.UISize;
	import enums.weapon.WeaponEnum;
	
	import model.vo.weapon.BaseBowGunWeaponVo;
	import model.vo.weapon.BaseShortWeaponVo;
	import model.vo.weapon.BaseWeaponVo;
	import model.vo.weapon.BugStickVo;
	import model.vo.weapon.ChargeAxeVo;
	import model.vo.weapon.FluteVo;
	import model.vo.weapon.GunLanceVo;
	import model.vo.weapon.LightBowGunVo;
	import model.vo.weapon.SlashAxeVo;
	
	import starling.display.Image;
	import starling.utils.Color;
	
	
	/**
	 * 武器util
	 * @author £iang
	 * 
	 */	
	public class WeaponUtil
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 狩猎笛音色数据 */
		public static const melodyData:Array = new Array(
			[ "0,6,1", "0,1,6" ],
			[ "0,1,4" ],
			[ "0,5,1", "0,1,5" ],
			[ "0,3,1", "0,1,3" ],
			[ "0,6,4", "0,4,6" ],
			[ "0,6,5" ],
			[ "0,6,3" ],
			[ "0,4,5" ],
			[ "0,3,4", "0,4,3" ],
			[ "0,3,5" ],
			[ "7,2,1" ],
			[ "7,2,6", "7,6,2" ],
			[ "7,5,2" ],
			[ "7,6,1", "7,1,6" ],
			[ "7,1,4" ],
			[ "7,5,1", "7,1,5" ],
			[ "7,3,1", "7,1,3" ],
			[ "7,6,4", "7,4,6" ],
			[ "7,6,5" ],
			[ "7,6,3" ],
			[ "7,4,5" ],
			[ "7,3,4", "7,4,3"  ],
			[ "7,3,5" ],
			[ "7,4,2" ],
			[ "7,3,2" ]
		);
		
		/** 猎虫技能数据 */
		public static const bugSkillData:Array = new Array(
			'<font color="#FFFFFF">无技能</font>',
			'<font color="#FF0000">攻击UP【小】</font>',
			'<font color="#FF0000">攻击UP【大】</font>',
			'<font color="#FF0000">攻击UP【中】</font><br/><font color="#00FF00">恢复UP【小】</font>',
			'<font color="#ffec61">耐力UP【小】</font>',
			'<font color="#ffec61">耐力UP【大】</font>',
			'<font color="#ffec61">耐力UP【中】</font><br/><font color="#00FF00">恢复UP【小】</font>',
			'<font color="#44ecfc">速度UP【小】</font>',
			'<font color="#44ecfc">速度UP【大】</font>',
			'<font color="#44ecfc">速度UP【中】</font><br/><font color="#00FF00">恢复UP【小】</font>',
			'<font color="#f01ae8">全能力UP【小】</font>',
			'<font color="#f01ae8">全能力UP【中】</font><br/><font color="#00FF00">恢复UP【大】</font>'
		);
		
		public static const bulletData:Array = new Array(
			{ name:"Lv1通常弹", simple:"通1", color:0xffffff },{ name:"Lv2通常弹", simple:"通2", color:0xffffff },{ name:"Lv3通常弹", simple:"通3", color:0xffffff },
			{ name:"Lv1贯通弹", simple:"贯1", color:0xffffff },{ name:"Lv2贯通弹", simple:"贯2", color:0xffffff },{ name:"Lv3贯通弹", simple:"贯3", color:0xffffff },
			{ name:"Lv1散弹", simple:"散1", color:0xffffff },{ name:"Lv2散弹", simple:"散2", color:0xffffff },{ name:"Lv3散弹", simple:"散3", color:0xffffff },
			{ name:"Lv1徹甲榴弹", simple:"徹1", color:0xffffff },{ name:"Lv2徹甲榴弹", simple:"徹2", color:0xffffff },{ name:"Lv3徹甲榴弹", simple:"徹3", color:0xffffff },
			{ name:"Lv1扩散弹", simple:"扩1", color:0xffffff },{ name:"Lv2扩散弹", simple:"扩2", color:0xffffff },{ name:"Lv3扩散弹", simple:"扩3", color:0xffffff },
			{ name:"竜击弹", simple:"竜", color:0xffffff },
			{ name:"Lv1回復弹", simple:"回1", color:ColorLib.RECOVER },{ name:"Lv2回復弹", simple:"回2", color:ColorLib.RECOVER },
			{ name:"Lv1毒弹", simple:"毒1", color:ColorLib.POISON },{ name:"Lv2毒弹", simple:"毒2", color:ColorLib.POISON },
			{ name:"Lv1麻痹弹", simple:"麻1", color:ColorLib.PARALYSIS },{ name:"Lv2麻痹弹", simple:"麻2", color:ColorLib.PARALYSIS },
			{ name:"Lv1睡眠弹", simple:"睡1", color:ColorLib.SLEEP },{ name:"Lv2睡眠弹", simple:"睡2", color:ColorLib.SLEEP },
			{ name:"Lv1减气弹", simple:"减1", color:ColorLib.STAMI },{ name:"Lv2减气弹", simple:"减2", color:ColorLib.STAMI },
			{ name:"爆破弹", simple:"爆", color:ColorLib.BOMB },{ name:"火炎弹", simple:"火", color:ColorLib.FIRE },
			{ name:"水冷弹", simple:"水", color:ColorLib.WATER },{ name:"电击弹", simple:"雷", color:ColorLib.BOMB },
			{ name:"冰结弹", simple:"冰", color:ColorLib.ICE },{ name:"灭龙弹", simple:"龙", color:ColorLib.DRAGON },
			{ name:"捕获用麻醉弹", simple:"捕", color:ColorLib.NARCOSIS },{ name:"染色弹", simple:"染", color:ColorLib.HINT },
			{ name:"鬼人弹", simple:"鬼", color:ColorLib.ATTACK },{ name:"硬化弹", simple:"硬", color:ColorLib.DEFFEND },
			{ name:"斩裂弹", simple:"斩", color:0xffffff }
		);
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 将obj类型转换为详细的BaseWeaponVo类型 
		 * @param obj object类型
		 * @return BaseWeaponVo类型 
		 * 
		 */				
		public static function mapObj2BaseWeaponVo( obj:Object ):BaseWeaponVo
		{
			var result:BaseWeaponVo = new BaseWeaponVo();
			
			result.weaponId = obj.weapon_id;
			result.name = obj.name;
			result.nickName = obj.nickName;
			result.rare = obj.rare;
			
			return result;
			
		}
		
		/**
		 * 将obj类型转换为简单的ShortWeaponVo类型 
		 * @param obj object类型
		 * @return ShortWeaponVo类型 
		 * 
		 */				
		public static function mapObj2ShortWeaponVo1( obj:Object ):BaseShortWeaponVo
		{
			var result:BaseShortWeaponVo = new BaseShortWeaponVo();
			
			result.weaponId = obj.weapon_id;
			result.name = obj.name;
			result.nickName = obj.nickName;
			result.rare = obj.rare;
			result.attack = obj.attack;
			result.attribute = obj.attribute;
			result.attriNum = obj.attriNum;
			result.isAwaken = obj.isAwaken;
			result.red1 = obj.red1;
			result.red2 = obj.red2;
			result.orange1 = obj.orange1;
			result.orange2 = obj.orange2;
			result.yellow1 = obj.yellow1;
			result.yellow2 = obj.yellow2;
			result.green1 = obj.green1;
			result.green2 = obj.green2;
			result.blue1 = obj.blue1;
			result.blue2 = obj.blue2;
			result.white1 = obj.white1;
			result.white2 = obj.white2;
			result.purple1 = obj.purple1;
			result.purple2 = obj.purple2;
			result.isFinal = obj.isFinal;
			
			return result;
		}
		
		
		/**
		 * 将obj类型转换为详细的ShortWeaponVo类型 
		 * @param obj object类型
		 * @return ShortWeaponVo类型 
		 * 
		 */				
		public static function mapObj2ShortWeaponVo2( obj:Object ):BaseShortWeaponVo
		{
			var result:BaseShortWeaponVo;
			
			result = mapObj2ShortWeaponVo1( obj );
			result.critical = obj.critical;
			result.defAdd = obj.defAdd;
			result.finalType = obj.finalType;
			result.identifyItem = obj.identifyItemVec;
			result.identifyNum = obj.identifyNumVec;
			result.level = obj.level;
			result.pre = obj.pre;
			result.produceItem = obj.produceItemVec;
			result.produceNum = obj.produceNumVec;
			result.producePrice = obj.producePrice;
			result.slot = obj.slot;
			result.strengthItem = obj.strengthItemVec;
			result.strengthNum = obj.strengthNumVec;
			result.strengthPrice = obj.strengthPrice;
			result.picId = obj.picId;
			
			return result;
		}
		
		/**
		 * 将obj类型转换为简单的FluteVo类型 
		 * @param obj object类型
		 * @return FluteVo类型 
		 * 
		 */				
		public static function mapObj2FluteVo1( obj:Object ):FluteVo
		{
			var result:FluteVo = new FluteVo();
			
			result.weaponId = obj.weapon_id;
			result.name = obj.name;
			result.nickName = obj.nickName;
			result.rare = obj.rare;
			result.attack = obj.attack;
			result.melody = ( obj.melody as String ).split( "," );
			result.red1 = obj.red1;
			result.red2 = obj.red2;
			result.orange1 = obj.orange1;
			result.orange2 = obj.orange2;
			result.yellow1 = obj.yellow1;
			result.yellow2 = obj.yellow2;
			result.green1 = obj.green1;
			result.green2 = obj.green2;
			result.blue1 = obj.blue1;
			result.blue2 = obj.blue2;
			result.white1 = obj.white1;
			result.white2 = obj.white2;
			result.purple1 = obj.purple1;
			result.purple2 = obj.purple2;
			result.isFinal = obj.isFinal;
			
			return result;
		}
		
		/**
		 * 将obj类型转换为详细的FluteVo类型 
		 * @param obj object类型
		 * @return FluteVo类型 
		 * 
		 */				
		public static function mapObj2FluteVo2( obj:Object ):FluteVo
		{
			var result:FluteVo;
			
			result = mapObj2FluteVo1( obj );
			result.attribute = obj.attribute;
			result.attriNum = obj.attriNum;
			result.isAwaken = obj.isAwaken;
			result.critical = obj.critical;
			result.defAdd = obj.defAdd;
			result.finalType = obj.finalType;
			result.identifyItem = obj.identifyItemVec;
			result.identifyNum = obj.identifyNumVec;
			result.level = obj.level;
			result.pre = obj.pre;
			result.produceItem = obj.produceItemVec;
			result.produceNum = obj.produceNumVec;
			result.producePrice = obj.producePrice;
			result.slot = obj.slot;
			result.strengthItem = obj.strengthItemVec;
			result.strengthNum = obj.strengthNumVec;
			result.strengthPrice = obj.strengthPrice;
			result.picId = obj.picId;
			return result;
		}
		
		/**
		 * 将obj类型转换为简单的GunLanceVo类型 
		 * @param obj object类型
		 * @return GunLanceVo类型 
		 * 
		 */				
		public static function mapObj2GunLanceVo1( obj:Object ):GunLanceVo
		{
			var result:GunLanceVo = new GunLanceVo();
			
			result.weaponId = obj.weapon_id;
			result.name = obj.name;
			result.nickName = obj.nickName;
			result.rare = obj.rare;
			result.attack = obj.attack;
			result.gunType = obj.gunType;
			result.gunLevel = obj.gunLevel;
			result.red1 = obj.red1;
			result.red2 = obj.red2;
			result.orange1 = obj.orange1;
			result.orange2 = obj.orange2;
			result.yellow1 = obj.yellow1;
			result.yellow2 = obj.yellow2;
			result.green1 = obj.green1;
			result.green2 = obj.green2;
			result.blue1 = obj.blue1;
			result.blue2 = obj.blue2;
			result.white1 = obj.white1;
			result.white2 = obj.white2;
			result.purple1 = obj.purple1;
			result.purple2 = obj.purple2;
			result.isFinal = obj.isFinal;
			
			return result;
		}
		
		/**
		 * 将obj类型转换为详细的GunLanceVo类型 
		 * @param obj object类型
		 * @return GunLanceVo类型 
		 * 
		 */				
		public static function mapObj2GunLanceVo2( obj:Object ):GunLanceVo
		{
			var result:GunLanceVo;
			
			result = mapObj2GunLanceVo1( obj );
			result.attribute = obj.attribute;
			result.attriNum = obj.attriNum;
			result.isAwaken = obj.isAwaken;
			result.critical = obj.critical;
			result.defAdd = obj.defAdd;
			result.finalType = obj.finalType;
			result.identifyItem = obj.identifyItemVec;
			result.identifyNum = obj.identifyNumVec;
			result.level = obj.level;
			result.pre = obj.pre;
			result.produceItem = obj.produceItemVec;
			result.produceNum = obj.produceNumVec;
			result.producePrice = obj.producePrice;
			result.slot = obj.slot;
			result.strengthItem = obj.strengthItemVec;
			result.strengthNum = obj.strengthNumVec;
			result.strengthPrice = obj.strengthPrice;
			result.picId = obj.picId;
			
			return result;
		}
		
		/**
		 * 将obj类型转换为简单的SlashAxeVo类型 
		 * @param obj object类型
		 * @return SlashAxeVo类型 
		 * 
		 */				
		public static function mapObj2SlashAxeVo1( obj:Object ):SlashAxeVo
		{
			var result:SlashAxeVo = new SlashAxeVo();
			
			result.weaponId = obj.weapon_id;
			result.name = obj.name;
			result.nickName = obj.nickName;
			result.rare = obj.rare;
			result.attack = obj.attack;
			result.bottle = obj.bottle;
			result.red1 = obj.red1;
			result.red2 = obj.red2;
			result.orange1 = obj.orange1;
			result.orange2 = obj.orange2;
			result.yellow1 = obj.yellow1;
			result.yellow2 = obj.yellow2;
			result.green1 = obj.green1;
			result.green2 = obj.green2;
			result.blue1 = obj.blue1;
			result.blue2 = obj.blue2;
			result.white1 = obj.white1;
			result.white2 = obj.white2;
			result.purple1 = obj.purple1;
			result.purple2 = obj.purple2;
			result.isFinal = obj.isFinal;
			
			return result;
		}
		
		/**
		 * 将obj类型转换为详细的GunLanceVo类型 
		 * @param obj object类型
		 * @return GunLanceVo类型 
		 * 
		 */				
		public static function mapObj2SlashAxeVo2( obj:Object ):SlashAxeVo
		{
			var result:SlashAxeVo;
			
			result = mapObj2SlashAxeVo1( obj );
			result.attribute = obj.attribute;
			result.attriNum = obj.attriNum;
			result.isAwaken = obj.isAwaken;
			result.critical = obj.critical;
			result.defAdd = obj.defAdd;
			result.finalType = obj.finalType;
			result.identifyItem = obj.identifyItemVec;
			result.identifyNum = obj.identifyNumVec;
			result.level = obj.level;
			result.pre = obj.pre;
			result.produceItem = obj.produceItemVec;
			result.produceNum = obj.produceNumVec;
			result.producePrice = obj.producePrice;
			result.slot = obj.slot;
			result.strengthItem = obj.strengthItemVec;
			result.strengthNum = obj.strengthNumVec;
			result.strengthPrice = obj.strengthPrice;
			result.picId = obj.picId;
			
			return result;
		}
		
		/**
		 * 将obj类型转换为简单的ChargeAxeVo类型 
		 * @param obj object类型
		 * @return ChargeAxeVo类型 
		 * 
		 */				
		public static function mapObj2ChargeAxeVo1( obj:Object ):ChargeAxeVo
		{
			var result:ChargeAxeVo = new ChargeAxeVo();
			
			result.weaponId = obj.weapon_id;
			result.name = obj.name;
			result.nickName = obj.nickName;
			result.rare = obj.rare;
			result.attack = obj.attack;
			result.bottle = obj.bottle;
			result.red1 = obj.red1;
			result.red2 = obj.red2;
			result.orange1 = obj.orange1;
			result.orange2 = obj.orange2;
			result.yellow1 = obj.yellow1;
			result.yellow2 = obj.yellow2;
			result.green1 = obj.green1;
			result.green2 = obj.green2;
			result.blue1 = obj.blue1;
			result.blue2 = obj.blue2;
			result.white1 = obj.white1;
			result.white2 = obj.white2;
			result.purple1 = obj.purple1;
			result.purple2 = obj.purple2;
			result.isFinal = obj.isFinal;
			
			return result;
		}
		
		/**
		 * 将obj类型转换为详细的ChargeAxeVo类型 
		 * @param obj object类型
		 * @return ChargeAxeVo类型 
		 * 
		 */				
		public static function mapObj2ChargeAxeVo2( obj:Object ):ChargeAxeVo
		{
			var result:ChargeAxeVo;
			
			result = mapObj2ChargeAxeVo1( obj );
			result.attribute = obj.attribute;
			result.attriNum = obj.attriNum;
			result.isAwaken = obj.isAwaken;
			result.critical = obj.critical;
			result.defAdd = obj.defAdd;
			result.finalType = obj.finalType;
			result.identifyItem = obj.identifyItemVec;
			result.identifyNum = obj.identifyNumVec;
			result.level = obj.level;
			result.pre = obj.pre;
			result.produceItem = obj.produceItemVec;
			result.produceNum = obj.produceNumVec;
			result.producePrice = obj.producePrice;
			result.slot = obj.slot;
			result.strengthItem = obj.strengthItemVec;
			result.strengthNum = obj.strengthNumVec;
			result.strengthPrice = obj.strengthPrice;
			result.picId = obj.picId;
			
			return result;
		}
		
		/**
		 * 将obj类型转换为简单的BugStickVo类型 
		 * @param obj object类型
		 * @return BugStickVo类型 
		 * 
		 */				
		public static function mapObj2BugStickVo1( obj:Object ):BugStickVo
		{
			var result:BugStickVo = new BugStickVo();
			
			result.weaponId = obj.weapon_id;
			result.name = obj.name;
			result.nickName = obj.nickName;
			result.rare = obj.rare;
			result.attack = obj.attack;
			result.bugType = obj.bugType;
			result.strengthBugLv = obj.strengthBugLv;
			result.red1 = obj.red1;
			result.red2 = obj.red2;
			result.orange1 = obj.orange1;
			result.orange2 = obj.orange2;
			result.yellow1 = obj.yellow1;
			result.yellow2 = obj.yellow2;
			result.green1 = obj.green1;
			result.green2 = obj.green2;
			result.blue1 = obj.blue1;
			result.blue2 = obj.blue2;
			result.white1 = obj.white1;
			result.white2 = obj.white2;
			result.purple1 = obj.purple1;
			result.purple2 = obj.purple2;
			result.isFinal = obj.isFinal;
			
			return result;
		}
		
		/**
		 * 将obj类型转换为详细的BugStickVo类型 
		 * @param obj object类型
		 * @return BugStickVo类型 
		 * 
		 */				
		public static function mapObj2BugStickVo2( obj:Object ):BugStickVo
		{
			var result:BugStickVo;
			
			result = mapObj2BugStickVo1( obj );
			result.attribute = obj.attribute;
			result.attriNum = obj.attriNum;
			result.isAwaken = obj.isAwaken;
			result.critical = obj.critical;
			result.defAdd = obj.defAdd;
			result.finalType = obj.finalType;
			result.identifyItem = obj.identifyItemVec;
			result.identifyNum = obj.identifyNumVec;
			result.level = obj.level;
			result.pre = obj.pre;
			result.produceItem = obj.produceItemVec;
			result.produceNum = obj.produceNumVec;
			result.producePrice = obj.producePrice;
			result.slot = obj.slot;
			result.strengthItem = obj.strengthItemVec;
			result.strengthNum = obj.strengthNumVec;
			result.strengthPrice = obj.strengthPrice;
			result.picId = obj.picId;
			
			return result;
		}	
		
		/**
		 * 将obj类型转换为简单的BaseBowGunWeaponVo类型 
		 * @param obj object类型
		 * @return BaseBowGunWeaponVo类型 
		 * 
		 */				
		public static function mapObj2BowGunVo( obj:Object ):BaseBowGunWeaponVo
		{
			var result:BaseBowGunWeaponVo = new BaseBowGunWeaponVo();
			
			result.weaponId = obj.weapon_id;
			result.name = obj.name;
			result.nickName = obj.nickName;
			result.rare = obj.rare;
			result.attack = obj.attack;
			result.reloadSpeed = obj.reloadSpeed;
			result.reaction = obj.reaction;
			result.offsetDirection = obj.offsetDirection;
			result.offsetLevel = obj.offsetLevel;
			if ( obj.specialBullet )
				result.specialBullet = ( obj.specialBullet as String ).split( "," );
			result.isFinal = obj.isFinal;
			
			return result;
		}
		
		/**
		 * 将obj类型转换为详细LightBowGunVo类型 
		 * @param obj object类型
		 * @return LightBowGunVo类型 
		 * 
		 */				
		public static function mapObj2LightBowGunVo2( obj:Object ):LightBowGunVo
		{
			var result:LightBowGunVo = new LightBowGunVo();
			
			result.weaponId = obj.weapon_id;
			result.name = obj.name;
			result.nickName = obj.nickName;
			result.rare = obj.rare;
			result.attack = obj.attack;
			result.reloadSpeed = obj.reloadSpeed;
			result.reaction = obj.reaction;
			result.offsetDirection = obj.offsetDirection;
			result.offsetLevel = obj.offsetLevel;
			
			if ( obj.specialBullet )
			{
				result.specialBullet = ( obj.specialBullet as String ).split( "," );
				result.specialBulletNum = ( obj.specialBulletNum as String ).split( "," );
				result.comboShotReaction = ( obj.comboShotReaction as String ).split( "," );
			}
				
			result.isFinal = obj.isFinal;
			
			result.ratioMirrorPrice = obj.ratioMirrorPrice;
			result.limitBreakPrice = obj.limitBreakPrice;
			result.addAttackPrice = obj.addAttackPrice;
			result.otherPrice = obj.otherPrice;
			result.addAttack = obj.addAttack;
			
			if ( obj.specialBulletAddNum )
				result.specialBulletAddNum = ( obj.specialBulletAddNum as String ).split( "," );
			
			result.carryBullet = ( obj.carryBullet as String ).split( "," );
			result.critical = obj.critical;
			result.defAdd = obj.defAdd;
			result.finalType = obj.finalType;
			result.identifyItem = obj.identifyItemVec;
			result.identifyNum = obj.identifyNumVec;
			result.level = obj.level;
			result.pre = obj.pre;
			result.produceItem = obj.produceItemVec;
			result.produceNum = obj.produceNumVec;
			result.producePrice = obj.producePrice;
			result.slot = obj.slot;
			result.strengthItem = obj.strengthItemVec;
			result.strengthNum = obj.strengthNumVec;
			result.strengthPrice = obj.strengthPrice;
			result.picId = obj.picId;
			return result;
		}
		
		/**
		 * 获得稀有度对应的颜色 
		 * @param rareNum
		 * @return 
		 * 
		 */		
		public static function getRareColor( rareNum:int ):uint
		{
			return ColorLib[ "Rare" + rareNum ];
		}
		
		/**
		 * 获取属性标签html内容
		 * @param attriId 属性id
		 * @param attriNum 属性值
		 * @param isAwaken 是否觉醒
		 * @return 
		 * 
		 */		
		public static function getAttributeLabelText( attriId:int, attriNum:int, isAwaken:Boolean ):String
		{
			var result:String = "";
			
			switch(attriId)
			{
				case WeaponEnum.FIRE:
				{
					result += '<font color="#' + ColorLib.FIRE.toString(16) + '">火 </font>';
					break;
				}
					
				case WeaponEnum.WATER:
				{
					result += '<font color="#' + ColorLib.WATER.toString(16) + '">水 </font>';
					break;
				}
					
				case WeaponEnum.THUNDER:
				{
					result += '<font color="#' + ColorLib.THUNDER.toString(16) + '">雷 </font>';
					break;
				}
					
				case WeaponEnum.ICE:
				{
					result += '<font color="#' + ColorLib.ICE.toString(16) + '">冰 </font>';
					break;
				}
					
				case WeaponEnum.DRAGON:
				{
					result += '<font color="#' + ColorLib.DRAGON.toString(16) + '">龙 </font>';
					break;
				}
					
				case WeaponEnum.POISON:
				{
					result += '<font color="#' + ColorLib.POISON.toString(16) + '">毒 </font>';
					break;
				}
					
				case WeaponEnum.PARALYSIS:
				{
					result += '<font color="#' + ColorLib.PARALYSIS.toString(16) + '">麻 </font>';
					break;
				}
					
				case WeaponEnum.SLEEP:
				{
					result += '<font color="#' + ColorLib.SLEEP.toString(16) + '">睡 </font>';
					break;
				}
					
				case WeaponEnum.BOMB:
				{
					result += '<font color="#' + ColorLib.BOMB.toString(16) + '">爆 </font>';
					break;
				}
					
				default:
				{
					break;
				}
			}
			
			if ( result != "" )
			{
				result += '<font color="#ffffff">' + attriNum + '</font>';
			
				if ( isAwaken )
				{
					var tmpStr:String = '<font color="#ffffff">(</font>' + result;
					
					result = tmpStr;
					result += '<font color="#ffffff">)</font>';
				}
			}
			
			return result;
		}
		
		/**
		 * 获取近身武器的简易斩味HTML文本信息 
		 * @param simpleVo 近身武器VO
		 * @return 
		 * 
		 */		
		public static function getSimpleSharpeLabelText( simpleVo:BaseShortWeaponVo ):String
		{
			var result:String = "";
			var sharpArr:Array;
			
			sharpArr = [ simpleVo.red1, simpleVo.orange1, simpleVo.yellow1, simpleVo.green1, simpleVo.blue1, simpleVo.white1, simpleVo.purple1 ];
			result += getMaxSharpeText( sharpArr );
			result += '<font color="#ffffff">(</font>';
			sharpArr = [ simpleVo.red2, simpleVo.orange2, simpleVo.yellow2, simpleVo.green2, simpleVo.blue2, simpleVo.white2, simpleVo.purple2 ];
			result += getMaxSharpeText( sharpArr );
			result += '<font color="#ffffff">)</font>';
			return result;
		}
		
		public static function getMaxSharpeText( sharpArr:Array ):String
		{
			var result:String = "";
			var maxSharpeIndex:int;
			
			for ( var i:int = sharpArr.length - 1; i >= 0; i -- )
			{
				if ( sharpArr[ i ] > 0 )
				{
					maxSharpeIndex = i;
					break;
				}
			}
			
			switch(maxSharpeIndex)
			{
				case WeaponEnum.RED_INDEX:
				{
					result += '<font color="#' + ColorLib.REDS.toString(16) + '">红</font>';
					break;
				}
					
				case WeaponEnum.ORANGE_INDEX:
				{
					result += '<font color="#' + ColorLib.ORANGES.toString(16) + '">橙</font>';
					break;
				}
					
				case WeaponEnum.YELLOW_INDEX:
				{
					result += '<font color="#' + ColorLib.YELLOWS.toString(16) + '">黄</font>';
					break;
				}
					
				case WeaponEnum.GREEN_INDEX:
				{
					result += '<font color="#' + ColorLib.GREENS.toString(16) + '">绿</font>';
					break;
				}
					
				case WeaponEnum.BLUE_INDEX:
				{
					result += '<font color="#' + ColorLib.BLUES.toString(16) + '">蓝</font>';
					break;
				}
					
				case WeaponEnum.WHITE_INDEX:
				{
					result += '<font color="#FFFFFF">白</font>';
					break;
				}
					
				case WeaponEnum.PURPLE_INDEX:
				{
					result += '<font color="#' + ColorLib.PURPLES.toString(16) + '">紫</font>';
					break;
				}
					
				default:
				{
					break;
				}
			}
			
			return result;
		}
		
		/**
		 * 获得武器洞字符 
		 * @param slot 武器洞数
		 * 
		 */		
		public static function getSlotText( slot:int ):String
		{
			var result:String = "";
			
			switch(slot)
			{
				case 0:
				{
					result = "---";
					break;
				}
					
				case 1:
				{
					result = "O--"
					break;
				}
					
				case 2:
				{
					result = "OO-"
					break;
				}
					
				case 3:
				{
					result = "OOO"
					break;
				}
					
				default:
				{
					break;
				}
			}
			
			return result;
		}
		
		/**
		 * 比较斩味 
		 * @param arr1 斩味数组1
		 * @param arr2 斩味数组2
		 * @param index 当前比较斩味
		 * @return 是否斩味更高
		 * 
		 */		
		public static function isSharper(arr1:Array, arr2:Array, index:int):Boolean
		{
			if(arr1[index] > arr2[index])
				return true;
			else if(arr1[index] < arr2[index])
				return false;
			else
			{
				if(index != 0)
					return isSharper(arr1, arr2, index - 1);
				else
					return true;
			}
			
			return false;
		}
		
		/**
		 * 将baseWeaponVo转换为列表用object 
		 * @param weaponVo weaponVo
		 * @return object 
		 * 
		 */		
		public static function mapWeaponVo2ListObj( weaponVo:BaseWeaponVo, weaponName:String ):Object
		{
			var tmpObj:Object = new Object();
			var tmpImage:Image;
			
			tmpObj.label = '<font color="#' + ( ColorLib[ "Rare" + weaponVo.rare ] as uint ).toString( 16 ) + 
				'">' + weaponVo.name + '(' + weaponVo.nickName + ')' + '</font>';
			tmpImage = new Image(  AtlasTextureGenerator.getWeaponIconTextureById( 
				weaponName, weaponVo.rare
			) );
			tmpImage.scaleX = tmpImage.scaleY = UISize.DPI_SCALE;
			tmpObj.icon = tmpImage;
			tmpObj.weaponId = weaponVo.weaponId;
			return tmpObj;
		}
		
		/**
		 * 获取旋律字符串 
		 * @param melodyArr 旋律id序列
		 * @return 旋律字符串
		 * 
		 */		
		public static function getMelodyText( melodyArr:Array ):String
		{
			var result:String = "";
			var len:int = melodyArr.length;
			
			for ( var i:int = 0; i < len; i ++ )
			{
				var note:int = melodyArr[ i ];
				var noteStr:String = ( i == len - 1 ) ? "♪" : "♪ ";
				
				switch(note)
				{
					case WeaponEnum.WHITE_NOTE:
					{
						result += '<font color="#' + Color.WHITE.toString(16) + '">' + noteStr + '</font>';
						break;
					}
						
					case WeaponEnum.RED_NOTE:
					{
						result += '<font color="#' + Color.RED.toString(16) + '">' + noteStr + '</font>';
						break;
					}
						
					case WeaponEnum.ORANGE_NOTE:
					{
						result += '<font color="#' + ColorLib.ORANGE.toString(16) + '">' + noteStr + '</font>';
						break;
					}
						
					case WeaponEnum.YELLOW_NOTE:
					{
						result += '<font color="#' + Color.YELLOW.toString(16) + '">' + noteStr + '</font>';
						break;
					}
						
					case WeaponEnum.GREEN_NOTE:
					{
						result += '<font color="#' + Color.LIME.toString(16) + '">' + noteStr + '</font>';
						break;
					}
						
					case WeaponEnum.AO_NOTE:
					{
						result += '<font color="#' + Color.AQUA.toString(16) + '">' + noteStr + '</font>';
						break;
					}
						
					case WeaponEnum.BLUE_NOTE:
					{
						result += '<font color="#' + Color.BLUE.toString(16) + '">' + noteStr + '</font>';
						break;
					}
						
					case WeaponEnum.PURPLE_NOTE:
					{
						result += '<font color="#' + Color.FUCHSIA.toString(16) + '">' + noteStr + '</font>';
						break;
					}
						
					default:
					{
						break;
					}
				}
			}
			
			return result;
		}
		
		/**
		 * 获取某一种音色的文本 
		 * @param type 音色种类
		 * @return 音色文本
		 * 
		 */		
		public static function getMelodyTypeText( type:int ):String
		{
			return getMelodyText( ( melodyData[ type ][0] as String ).split( "," ) );
		}
		
		/**
		 * 获取所有种类音色的文本 
		 * @return 文本列表
		 * 
		 */		
		public static function getMelodyTypeTextVec():Vector.<String>
		{
			var len:int = melodyData.length;
			var result:Vector.<String> = new Vector.<String>();
			
			for ( var i:int = 0; i < len; i ++ )
			{
				result.push( getMelodyTypeText( i ) );
			}
			
			return result;
		}
		
			
		/**
		 * 获得某一类型音色的搜索语句 
		 * @param type 音色类型
		 * @return 搜索语句
		 * 
		 */		
		public static function getMelodyTypeSearchStr( type:int ):String
		{
			var result:String = ' and melody = "' + melodyData[ type ][0] + '"';
			
			if ( ( melodyData[ type ] as Array ).length == 2 )
			{
				result += ' or melody = "' + melodyData[ type ][1] + '"';
			}
			
			return result;
		}
		
		/**
		 * 获得某一炮击类型的搜索语句 
		 * @param type 炮击类型
		 * @return 搜索语句
		 * 
		 */		
		public static function getGunTypeSearchStr( type:int ):String
		{
			var result:String = "";
			var gunStr:String = "";
			
			switch(type)
			{
				case 0:
				{
					gunStr = "通常";
					break;
				}
					
				case 1:
				{
					gunStr = "放射";
					break;
				}
					
				case 2:
				{
					gunStr = "扩散";
					break;
				}
					
				default:
				{
					break;
				}
			}
			
			result = ' and gunType = "' + gunStr + '"';
			
			return result;
		}
		
		/**
		 * 获取某一音色数组的类型
		 * @param arr 音色数组
		 * @return 音色类型
		 * 
		 */		
		public static function getMelodyType( arr:Array ):int
		{
			var result:int = -1;
			var len:int = melodyData.length;
			var melodyStr:String = arr.join( "," );
			
			for ( var i:int = 0; i < len; i ++ )
			{
				var len2:int = ( melodyData[ i ] as Array ).length;
				
				for ( var j:int = 0; j < len2; j ++ )
				{
					if ( melodyData[ i ][ j ] == melodyStr )
					{
						result = i;
						break;
					}
				}
				
				if ( result >= 0)
					break;
			}
			
			return result;
		}
		
		/**
		 * 获取斩击斧瓶类型文本 
		 * @param type 瓶类型
		 * @return 文本
		 * 
		 */		
		public static function getSlashAxeBottleText( type:int ):String
		{
			var result:String = "";
			
			switch(type)
			{
				case WeaponEnum.SLASH_AXE_STRIKE:
				{
					result = '<font color="#FF0000">强击瓶</font>';
					break;
				}
					
				case WeaponEnum.SLASH_AXE_ATTRIBUTE:
				{
					result = '<font color="#00FF00">强属瓶</font>';
					break;
				}
					
				case WeaponEnum.SLASH_AXE_DRAGON:
				{
					result = '<font color="#' + ColorLib.DRAGON.toString(16) + '">灭龙瓶</font>';
					break;
				}
					
				case WeaponEnum.SLASH_AXE_POISON:
				{
					result = '<font color="#' + ColorLib.POISON.toString(16) + '">毒瓶</font>';
					break;
				}
					
				case WeaponEnum.SLASH_AXE_PARALYSIS:
				{
					result = '<font color="#' + ColorLib.PARALYSIS.toString(16) + '">麻痹瓶</font>';
					break;
				}
					
				case WeaponEnum.SLASH_AXE_FATIGUE:
				{
					result = '<font color="#' + ColorLib.STAMI.toString(16) + '">灭气瓶</font>';
					break;
				}
					
				default:
				{
					break;
				}
			}
			
			return result;
		}
		
		/**
		 * 获取充能斧瓶类型文本 
		 * @param type 瓶类型
		 * @return 文本
		 * 
		 */		
		public static function getChargeAxeBottleText( type:int ):String
		{
			var result:String = "";
			
			switch(type)
			{
				case WeaponEnum.CHARGE_AXE_GRENADE:
				{
					result = '<font color="#' + ColorLib.GRENADE.toString( 16 ) + '">榴弹瓶</font>';
					break;
				}
					
				case WeaponEnum.CHARGE_AXE_ATTRIBUTE:
				{
					result = '<font color="#00FF00">强属瓶</font>';
					break;
				}
					
				default:
				{
					break;
				}
			}
			
			return result;
		}
		
		/**
		 * 获取操虫棍猎虫类型文本 
		 * @param type 类型
		 * @return 文本
		 * 
		 */		
		public static function getBugStickBugText( type:int ):String
		{
			var result:String = "";
			
			switch(type)
			{
				case WeaponEnum.BUG_STICK_MODE_BEAT:
				{
					result = '打击';
					break;
				}
					
				case WeaponEnum.BUG_STICK_MODE_CUT:
				{
					result = '切断';
					break;
				}
					
				default:
				{
					break;
				}
			}
			
			return result;
		}
		
		/**
		 * 获取猎虫技能文本 
		 * @param skillId 技能id
		 * @return 文本
		 * 
		 */		
		public static function getBugSkillText( skillId:int ):String
		{
			return bugSkillData[ skillId ];
		}
		
		/**
		 * 获取弩类简表特殊弹种子弹列表文本 
		 * @param bulletArr 子弹列表
		 * @return  文本
		 * 
		 */		
		public static function getSimpleSpecialBulletNamesText( bulletArr:Array ):String
		{
			var result:String = "";
			var len:int = bulletArr.length;
			
			for ( var i:int = 0; i < len; i ++ )
			{
				if ( i == 2 )
					result += "<br/>";
				
				result += getSimpleSpecialBulletName( bulletArr[ i ] ) + "  ";
			}
			
			return result;
		}
		
		/**
		 * 获取特殊弹种的详细名称文本
		 * @param bulletId 子弹id
		 * @return 文本
		 * 
		 */		
		public static function getDetialSpecialBulletName( bulletId:int ):String
		{
			return '<font color="#' + bulletData[ bulletId ].color.toString( 16 ) + '">' + 
				bulletData[ bulletId ].name + '</font>';
		}
		
		/**
		 * 获取特殊弹种的缩略名称文本
		 * @param bulletId 子弹id
		 * @return 文本
		 * 
		 */		
		public static function getSimpleSpecialBulletName( bulletId:int ):String
		{
			return '<font color="#' + bulletData[ bulletId ].color.toString( 16 ) + '">' + 
				bulletData[ bulletId ].simple + '</font>';
		}
		
		/**
		 * 获取弩类装填速度文本 
		 * @param type 装填速度种类
		 * @return 文本
		 * 
		 */		
		public static function getBowGunReloadText( type:int ):String
		{
			var result:String = "";
			
			switch(type)
			{
				case WeaponEnum.RELOAD_EXTREME_SLOW:
				{
					result = "最慢";
					break;
				}
					
				case WeaponEnum.RELOAD_VERY_SLOW:
				{
					result = "极慢";
					break;
				}
					
				case WeaponEnum.RELOAD_SLOW:
				{
					result = "慢";
					break;
				}
					
				case WeaponEnum.RELOAD_LITTLE_SLOW:
				{
					result = "稍慢";
					break;
				}
					
				case WeaponEnum.RELOAD_NORMAL:
				{
					result = "普通";
					break;
				}
					
				case WeaponEnum.RELOAD_LITTEL_FAST:
				{
					result = "稍快";
					break;
				}
					
				case WeaponEnum.RELOAD_FAST:
				{
					result = "快";
					break;
				}
					
				case WeaponEnum.RELOAD_VERY_FAST:
				{
					result = "极快";
					break;
				}
					
				case WeaponEnum.RELOAD_EXTREME_FAST:
				{
					result = "最快";
					break;
				}
					
				default:
				{
					break;
				}
			}
			
			return result;
		}
		
		/**
		 * 获得弩类反动文本 
		 * @param type 反动类型
		 * @return 文本
		 * 
		 */		
		public static function getBowGunReactionText( type:int ):String
		{
			var result:String = "";
			
			switch(type)
			{
				case WeaponEnum.REACTION_EXTREME_HIGH:
				{
					result = "最大";
					break;
				}
					
				case WeaponEnum.REACTION_HIGH:
				{
					result = "大";
					break;
				}
					
				case WeaponEnum.REACTION_MIDDLE:
				{
					result = "中";
					break;
				}
					
				case WeaponEnum.REACTION_LITTLE_LOW:
				{
					result = "稍小";
					break;
				}
					
				case WeaponEnum.REACTION_LOW:
				{
					result = "小";
					break;
				}
					
				case WeaponEnum.REACTION_VERY_LOW:
				{
					result = "极小";
					break;
				}
					
				case WeaponEnum.REACTION_EXTREME_LOW:
				{
					result = "最小";
					break;
				}
					
				default:
				{
					break;
				}
			}
			
			return result;
		}
		
		/**
		 * 获取弩类弹道偏移文本 
		 * @param direction 偏移方向
		 * @param level 偏移大小
		 * @return 文本
		 * 
		 */		
		public static function getBowGunOffsetText( direction:int, level:int ):String
		{
			var result:String = "";
			
			switch(direction)
			{
				case WeaponEnum.OFFSET_DIRECTION_NONE:
				{
					result = "无";
					return result;
				}
					
				case WeaponEnum.OFFSET_DIRECTION_LEFT:
				{
					result = "左";
					break;
				}
					
				case WeaponEnum.OFFSET_DIRECTION_RIGHT:
				{
					result = "右";
					break;
				}
					
				case WeaponEnum.OFFSET_DIRECTION_LR:
				{
					result = "左右";
					break;
				}
					
				default:
				{
					break;
				}
			}
			
			result += "/";
			
			switch(level)
			{
				case WeaponEnum.OFFSET_LEVEL_LOW:
				{
					result += "小";
					break;
				}
					
				case WeaponEnum.OFFSET_LEVEL_HIGH:
				{
					result += "大";
					break;
				}
					
				default:
				{
					break;
				}
			}
			
			return result;
		}
		
		/**
		 * 获取轻弩速射反动类型文本 
		 * @param type 类型
		 * @return 文本
		 * 
		 */	
		public static function getQuickShotReactionText( type:int ):String
		{
			var result:String = "";
			
			switch(type)
			{
				case WeaponEnum.QUICK_SHOT_REACTION_LOW:
				{
					result = "小";
					break;
				}
					
				case WeaponEnum.QUICK_SHOT_REACTION_MIDDLE:
				{
					result = "中";
					break;
				}
					
				case WeaponEnum.QUICK_SHOT_REACTION_HIGH:
				{
					result = "大";
					break;
				}
					
				default:
				{
					break;
				}
			}
			
			return result;
		}
		
		/**
		 * 获取载弹量文本 
		 * @param num 载弹量
		 * @return 文本
		 * 
		 */		
		public static function getCarryBulletText( num:int ):String
		{
			var result:String = "";
		
			if ( num > 0 )
			{
				result = getFormatNum( num );
			}
			else if ( num == 0 )
			{
				result = "---";
			}
			else
			{
				result = '<font color="#' + ColorLib.SEA.toString( 16 ) + '">' + 
					getFormatNum( int( Math.abs( num ) ) ) + '</font>';
			}
			
			return result;
		}
		
		/**
		 * 格式化数字 
		 * @param num 数字
		 * @return 
		 * 
		 */		
		public static function getFormatNum( num:int ):String
		{
			return num < 10 ? '0' + num : num.toString();
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function WeaponUtil()
		{
		}
	}
}